package com.example.demo1104.demo2;

import java.util.function.Supplier;

public class Test03 {
    public static void main(String[] args) {

        Job job = new Job("主播", "直播");

       // Supplier<String> sup=()-> job.getName();

        Supplier<String> sup=job::getName;
        System.out.println(sup.get());
    }
}
class  Job{
    private String name;
    private String nature;

    public Job(String name, String nature) {
        this.name = name;
        this.nature = nature;
    }

    @Override
    public String toString() {
        return "Job{" +
                "name='" + name + '\'' +
                ", nature='" + nature + '\'' +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNature() {
        return nature;
    }

    public void setNature(String nature) {
        this.nature = nature;
    }
}
